package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IPatrolFeedBackSureView;
import com.cloudsigns.factorymanager2.engineering.IView.IPublicationFeedBackSureView;
import com.cloudsigns.factorymanager2.engineering.model.IPatrolFeedBackSureModel;
import com.cloudsigns.factorymanager2.engineering.model.IPublicationFeedBackSureModel;
import com.cloudsigns.factorymanager2.engineering.model.PatrolFeedBackSureModel;
import com.cloudsigns.factorymanager2.engineering.model.PublicationFeedBackSureModel;

/**
 * Created by tony on 2018/6/22.
 */

public class PatrolFeedBackSurePresenter {
    private IPatrolFeedBackSureView view;
    private IPatrolFeedBackSureModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public PatrolFeedBackSurePresenter(IPatrolFeedBackSureView view) {
        this.view = view;
        this.model = new PatrolFeedBackSureModel();
    }

    public void patrolFeedBackSure() {


        model.patrolFeedBackSure(view.getContent(),view.getOrderId(),view.getItemId(),view.getType(), new  PatrolFeedBackSureModel.OnPatrolFeedBackSureListener() {
            @Override
            public void patrolFeedBackSureSuccessed() {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.patrolFeedBackSureSuccessed();
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void patrolFeedBackSureFailed(final String desc) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.patrolFeedBackSureFailed(desc);
                        view.hideLoading();
                    }
                });
            }


        });
    }
}
